package com.zheng.client.filter;


import com.zheng.client.util.IpUtil;
import org.springframework.stereotype.Component;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
@Component
@WebFilter
public class RequestFilter implements Filter {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
     String ip= IpUtil.getInstance().getIp((HttpServletRequest)servletRequest);
     IpUtil.getInstance().setIp(ip);
     filterChain.doFilter(servletRequest,servletResponse);
    }
}
